<template>
  <div ref="chart" style="width: 600px; height: 400px"></div>
</template>

<script>
import * as echarts from "echarts";

export default {
  name: "Chart",
  mounted() {
    this.initChart();
  },
  methods: {
    initChart() {
      // 基于准备好的dom，初始化echarts实例
      const myChart = echarts.init(this.$refs.chart);
      const option = {

        xAxis: [
          {
            data: ["2001-01-01", "2001-01-02", "2001-01-03", "2001-01-04", "2001-01-05", "2001-01-06"],
            gridIndex: 0,
          },
          {
            data: ["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"],
            gridIndex: 1,
          },
        ],
        yAxis: [
          {
            gridIndex: 0,
          },
          {
            gridIndex: 1,
          },
        ],
        grid: [
          {
            bottom: "60%",
          },
          {
            top: "60%",
          },
        ],
        series: [
          {
            type: "line",
            data: [1,2,3,6,3,1],
            xAxisIndex: 0,
            yAxisIndex: 0,
          },
          {
            type: "line",
            data: [10,21,3,6,31,1],
            xAxisIndex: 1,
            yAxisIndex: 1,
          },
        ],
      };
      // 使用刚指定的配置项和数据显示图表。
      myChart.setOption(option);
    },
  },
};
</script>

<style scoped>
/* 在这里添加你的样式 */
</style>